<extend name="Base/common"/>

<block name="header">
    <!-- <header class=" subhead" id="overview"> -->
        <!-- <div class="container"> -->
            <!-- <h2>Hey Joke</h2> -->
            <!-- <p class="lead"></p> -->
        <!-- </div> -->
    <!-- </header> -->
</block>

<block name="side">
<!-- 左侧 nav
================================================== -->
    <include file="Public/left_bar"/>
</block>

<block name="body">
    <div class="span9">
        <!-- Contents
        ================================================== -->
        <section id="contents">

            <table class="table table-hover">
                <if condition="$info.on gt 0">
                    <tr>
                        <td>签到</td>
                        <td>{$info.on|date='Y-m-d H:i:s',###}</td>
                    </tr>
                <else/>
                    <tr>
                        <td>签到</td>
                        <td><input type="button" class="btn btn-info qiandao" value="签到" ></td>
                    </tr>
                    </if>
                <if condition="$info.off gt 0">
                <tr>
                    <td>签退</td>
                    <td>{$info.off|date='Y-m-d H:i:s',###}<input type="button" class="btn btn-info qiantui" value="签退" ></td>
                </tr>
                    <else/>
                    <tr>
                        <td>签退</td>
                        <td><input type="button" class="btn btn-info qiantui" value="签退" ></td>
                    </tr>
                    </if>
            </table>






        </section>
    </div>
        </div>
    <script>
        $(document).ready(function(){
            $(".qiandao").click(function(){
                var obj = $(this);
                $.post("{:U('Daily/do_active')}",{},function(msg){
                    obj.attr('value',msg.info);
                    if(msg.status==200){
                        obj.removeClass('btn-info');
                        obj.addClass('btn-success');
                        obj.fadeOut();
                        obj.parent().html(msg.data);
                    } else {
                        obj.removeClass('btn-info');
                        obj.addClass('btn-danger');
                    }
                },'json');
            });
            $(".qiantui").click(function(){
                var obj = $(this);
                $.post("{:U('Daily/off_active')}",{},function(msg){
                    obj.attr('value',msg.info);
                    if(msg.status==200){
                        obj.removeClass('btn-info');
                        obj.addClass('btn-success');
//                        obj.parent().html(msg.data+'<input type="button" class="btn btn-info qiantui" value="签退" >');
                    } else {
                        obj.removeClass('btn-info');
                        obj.addClass('btn-danger');
                    }
                },'json');
            });
        });



    </script>
</block>


